<template>
  <el-tabs v-model="activeName">
    <el-tab-pane label="全局配置" name="MainConfig">
      <el-form-item label="区域ID：">
        <el-input v-model="configValue.regionId" placeholder="请输入区域ID"/>
      </el-form-item>

      <el-form-item label="访问密匙ID：">
        <el-input v-model="configValue.accessKeyId" placeholder="请输入访问密匙ID"/>
      </el-form-item>

      <el-form-item label="访问密匙Secret：">
        <el-input v-model="configValue.accessKeySecret" placeholder="请输入访问密匙Secret"/>
      </el-form-item>
    </el-tab-pane>

    <el-tab-pane label="STS授权配置" name="STSConfig">
      <el-form-item label="域名：">
        <el-input v-model="configValue.ossDomain" placeholder="阿里云绑定的域名"/>
      </el-form-item>
      <el-form-item label="路径前缀：">
        <el-input v-model="configValue.ossPrefix" placeholder="不设置默认为空"/>
      </el-form-item>
      <el-form-item label="BucketName：">
        <el-input v-model="configValue.ossBucketName" placeholder="阿里云BucketName"/>
      </el-form-item>

      <el-form-item label="区域ID：">
        <el-input v-model="configValue.stsRegionId" placeholder="请输入区域ID"/>
      </el-form-item>

      <el-form-item label="访问密匙ID：">
        <el-input v-model="configValue.stsAccessKeyId" placeholder="请输入访问密匙ID"/>
      </el-form-item>

      <el-form-item label="访问密匙Secret：">
        <el-input v-model="configValue.stsAccessKeySecret" placeholder="请输入访问密匙"/>
      </el-form-item>

      <el-form-item label="RAM角色ARN：">
        <el-input v-model="configValue.stsRoleArn" placeholder="请输入RAM角色ARN"/>
      </el-form-item>

      <el-form-item label="角色会话名称：">
        <el-input v-model="configValue.stsRoleSessionName" placeholder="请输入角色会话名称"/>
      </el-form-item>

      <el-form-item label="Token有效期：">
        <el-input-number v-model="configValue.stsDurationSeconds" :min="60" :precision="0" :step="60" controls-position="right"/>
      </el-form-item>

      <el-form-item label="权限策略：">
        <el-input v-model="configValue.stsPolicy" :autosize="{ minRows: 3}" placeholder="请输入权限策略JSON数据" type="textarea"/>
      </el-form-item>
    </el-tab-pane>

    <el-tab-pane label="OCR识别配置" name="OCRConfig">

      <el-form-item label="访问密匙ID：">
        <el-input v-model="configValue.ocrAccessKeyId" placeholder="请输入访问密匙ID"/>
      </el-form-item>

      <el-form-item label="访问密匙Secret：">
        <el-input v-model="configValue.ocrAccessKeySecret" placeholder="请输入访问密匙Secret"/>
      </el-form-item>
    </el-tab-pane>
  </el-tabs>
</template>

<script lang="ts" setup>
import { ref } from 'vue';

defineOptions({name: 'AliyunCsConfig'})

const props = defineProps({
  configValue: {
    type: Object,
    required: true
  },
  configType: {
    type: Number,
    default: 0,
    required: true
  },
  readonly: {
    type: Boolean,
    default: false
  },
});

const activeName = ref('MainConfig');
</script>

<style lang="scss" scoped>

</style>
